package os;

import java.util.Scanner;

/**
 * @author mubei
 * @date 2021/12/8
 * @description
 */
public class CurriculumDesign {

    static int[] array = {1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 9, 5, 4, 5, 4, 2};
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        boolean flag = true;
        while (flag){
            print();
            int key = scanner.nextInt();

            int size=-1;
            switch (key){
                case 1:
                    System.out.println("输入虚拟内存大小");
                    size = scanner.nextInt();
                    FIFO fifo = new FIFO(size);
                    fifo.calc();
                    break;
                case 2:
                    System.out.println("输入虚拟内存大小");
                    size = scanner.nextInt();
                    LRU lru = new LRU(size);
                    lru.calc();
                    break;
                case 3:
                    System.out.println("输入虚拟内存大小");
                    size = scanner.nextInt();
                    OPT opt = new OPT(size);
                    opt.calc(array);
                    break;
                case 4:
                    flag = false;
                    break ;
                default:
                    System.out.println("输入有误 请重新输入");
            }
        }
    }

    public static void print(){
        System.out.println("输入选择的替换算法");
        System.out.println("1.FIFO");
        System.out.println("2.LRU");
        System.out.println("3.OPT");
        System.out.println("4.EXIT");
    }
}
